﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/MenuMaster.Master" AutoEventWireup="true"
    CodeBehind="ViewAllDocuments.aspx.cs" Inherits="Department.admin.Content.ViewAllDocuments" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <asp:UpdatePanel ID="FilterUpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel ID="FilterHeader" runat="server">
                    <div class="table-header-repeat line-left minwidth-1">
                        <asp:LinkButton ID="FilterLnkBtn" runat="server" Text="Търсене в документи"></asp:LinkButton></div>
                    <br />
                    <br />
                </asp:Panel>
                <asp:Panel ID="FilterBody" runat="server" DefaultButton="FilterButton">
                    <table>
                        <tr>
                            <th>
                                Заглавие:
                            </th>
                            <th>
                                Дата:
                            </th>
                            <th>
                                Част от описанието:
                            </th>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox CssClass="top-search-inp" runat="server" ToolTip="Търсене по заглавие."
                                    ID="FilterTitleTextBox"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="[a-zA-Zа-яА-Я0-9._\s\S]{3,50}"
                                    ControlToValidate="FilterTitleTextBox"></asp:RegularExpressionValidator>
                            </td>
                            <td>
                                <asp:TextBox runat="server" ToolTip="Търсене по дата." ID="FilterDateTextBox" CssClass="top-search-inp"></asp:TextBox>
                                <style type="text/css">
                                    .cal_Theme1 .ajax__calendar_container
                                    {
                                        background-color: #e2e2e2;
                                        border: solid 1px #cccccc;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_header
                                    {
                                        background-color: #ffffff;
                                        margin-bottom: 4px;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_title, .cal_Theme1 .ajax__calendar_next, .cal_Theme1 .ajax__calendar_prev
                                    {
                                        color: #004080;
                                        padding-top: 3px;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_body
                                    {
                                        background-color: #e9e9e9;
                                        border: solid 1px #cccccc;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_dayname
                                    {
                                        text-align: center;
                                        font-weight: bold;
                                        margin-bottom: 4px;
                                        margin-top: 2px;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_day
                                    {
                                        text-align: center;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_hover .ajax__calendar_day, .cal_Theme1 .ajax__calendar_hover .ajax__calendar_month, .cal_Theme1 .ajax__calendar_hover .ajax__calendar_year, .cal_Theme1 .ajax__calendar_active
                                    {
                                        color: #004080;
                                        font-weight: bold;
                                        background-color: #ffffff;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_today
                                    {
                                        font-weight: bold;
                                    }
                                    
                                    .cal_Theme1 .ajax__calendar_other, .cal_Theme1 .ajax__calendar_hover .ajax__calendar_today, .cal_Theme1 .ajax__calendar_hover .ajax__calendar_title
                                    {
                                        color: #bbbbbb;
                                    }
                                </style>
                                <asp:CalendarExtender CssClass="cal_Theme1" ID="CalendarExtender" Format="dd.MM.yyyy"
                                    TargetControlID="FilterDateTextBox" runat="server">
                                </asp:CalendarExtender>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
                                    ControlToValidate="FilterDateTextBox"></asp:RegularExpressionValidator>
                            </td>
                            <td>
                                <asp:TextBox CssClass="top-search-inp" runat="server" ToolTip="Търсене по Част от описанието."
                                    ID="FilterDescTextBox"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ValidationExpression="[a-zA-Zа-яА-Я0-9._\s\S]{3,255}"
                                    ControlToValidate="FilterDescTextBox"></asp:RegularExpressionValidator>
                            </td>
                            <td align="right">
                                <asp:ImageButton ID="FilterButton" runat="server" ImageUrl="/admin/images/shared/top_search_btn.gif"
                                    Text="Търси" OnClick="FilterButton_Click" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="FilterLabel" runat="server" Visible="false"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:CollapsiblePanelExtender ID="cpe" CollapseControlID="FilterHeader" ExpandControlID="FilterHeader"
                    TargetControlID="FilterBody" Collapsed="true" TextLabelID="FilterLnkBtn" CollapsedSize="0"
                    runat="server" AutoCollapse="False" AutoExpand="False">
                </asp:CollapsiblePanelExtender>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div id="page-heading">
        <h1>
            Всички документи</h1>
    </div>
    <!-- end page-heading -->
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
        <tr>
            <th rowspan="3" class="sized">
                <img src="../images/shared/side_shadowleft.jpg" width="20" height="300" alt="" />
            </th>
            <th class="topleft">
            </th>
            <td id="tbl-border-top">
                &nbsp;
            </td>
            <th class="topright">
            </th>
            <th rowspan="3" class="sized">
                <img src="../images/shared/side_shadowright.jpg" width="20" height="300" alt="" />
            </th>
        </tr>
        <tr>
            <td id="tbl-border-left">
            </td>
            <td>
                <!--  start content-table-inner ...................................................................... START -->
                <div id="content-table-inner">
                    <!--  start table-content  -->
                    <div id="table-content">
                        <asp:SqlDataSource ID="itemsViewDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:DepartmentConnectionString %>"
                            SelectCommand="SELECT ID, Name, Description, Link, IsHidden, FacDeptID, Date FROM Documents WHERE (FacDeptID = dbo.uf_get_department_id())">
                        </asp:SqlDataSource>
                        <form id="mainform" action="">
                        <asp:UpdatePanel ID="UpdateContentPanel" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
                                    <tr>
                                        <th class="table-header-check">
                                            <asp:CheckBox ID="toggleall" runat="server" AutoPostBack="True" OnCheckedChanged="toggleall_CheckedChanged" />
                                        </th>
                                        <th class="table-header-repeat line-left minwidth-1">
                                            <asp:LinkButton ID="sortByName" OnCommand="sortByHeading_Click" CommandArgument="Name"
                                                runat="server">Име</asp:LinkButton>
                                        </th>
                                        <th class="table-header-repeat line-left minwidth-1">
                                            <asp:LinkButton ID="sortByDescription" OnCommand="sortByHeading_Click" CommandArgument="Description"
                                                runat="server">Описание</asp:LinkButton>
                                        </th>
                                        <th class="table-header-repeat line-left minwidth-1">
                                            <asp:LinkButton ID="LinkButton1" OnCommand="sortByHeading_Click" CommandArgument="Date"
                                                runat="server">Дата</asp:LinkButton>
                                        </th>
                                        <th class="table-header-repeat line-left minwidth-1">
                                            <asp:LinkButton ID="sortByLink" OnCommand="sortByHeading_Click" CommandArgument="Link"
                                                runat="server">Линк</asp:LinkButton>
                                        </th>
                                        <th class="table-header-repeat line-left">
                                            <asp:LinkButton ID="sortByIsHidden" OnCommand="sortByHeading_Click" CommandArgument="IsHidden"
                                                runat="server">Скрито</asp:LinkButton>
                                        </th>
                                        <th class="table-header-options line-left">
                                            <a href="">Действия</a>
                                        </th>
                                    </tr>
                                    <asp:ListView ID="itemsView" runat="server" DataSourceID="itemsViewDataSource">
                                        <ItemTemplate>
                                            <tr style="">
                                                <td>
                                                    <asp:CheckBox ID="CheckBoxIsMarked" runat="server" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                                </td>
                                                <td>
                                                    <asp:Label ID="OfficeLabel" runat="server" Text='<%# Eval("Description") %>' />
                                                </td>
                                                <td>
                                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Date", "{0:D}") %>' />
                                                </td>
                                                <td>
                                                    <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Link") %>' />
                                                </td>
                                                <td>
                                                    <asp:CheckBox ID="IsHiddenCheckBox" runat="server" Checked='<%# (DataBinder.Eval(Container.DataItem,"IsHidden")) %>' />
                                                </td>
                                                <td class="options-width">
                                                    <asp:HyperLink ID="Edit" title="Редактирай" class="icon-1 info-tooltip" runat="server"
                                                        NavigateUrl='<%#"/admin/Content/EditDocuments.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID")%>'>
                                                    </asp:HyperLink>
                                                    <asp:LinkButton ID="deleteButton" title="Направи неактивно" OnCommand="markInactiveButton_Click"
                                                        CommandArgument='<%#Eval("ID") %>' runat="server" class="icon-2 info-tooltip"></asp:LinkButton>
                                                    <asp:Label Visible="false" ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                        <AlternatingItemTemplate>
                                            <tr style="" class="alternate-row">
                                                <td>
                                                    <asp:CheckBox ID="CheckBoxIsMarked" runat="server" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                                </td>
                                                <td>
                                                    <asp:Label ID="OfficeLabel" runat="server" Text='<%# Eval("Description") %>' />
                                                </td>
                                                <td>
                                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Date", "{0:D}") %>' />
                                                </td>
                                                <td>
                                                    <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Link") %>' />
                                                </td>
                                                <td>
                                                    <asp:CheckBox ID="IsHiddenCheckBox" runat="server" Checked='<%# (DataBinder.Eval(Container.DataItem,"IsHidden")) %>' />
                                                </td>
                                                <td class="options-width">
                                                    <asp:HyperLink ID="Edit" title="Редактирай" class="icon-1 info-tooltip" runat="server"
                                                        NavigateUrl='<%#"/admin/Content/EditDocuments.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID")%>'>
                                                    </asp:HyperLink>
                                                    <asp:LinkButton ID="deleteButton" title="Направи неактивно" OnCommand="markInactiveButton_Click"
                                                        CommandArgument='<%#Eval("ID") %>' runat="server" class="icon-2 info-tooltip"></asp:LinkButton>
                                                    <asp:Label Visible="false" ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                                                </td>
                                            </tr>
                                        </AlternatingItemTemplate>
                                    </asp:ListView>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:DataPager ID="DataPagerListView" runat="server" PageSize="10" PagedControlID="itemsView">
                            <Fields>
                                <asp:NumericPagerField ButtonType="Link" NextPageText="" PreviousPageText="" ButtonCount="999999" />
                            </Fields>
                        </asp:DataPager>
                        </form>
                    </div>
                    <!--  end content-table  -->
                    <!--  start actions-box ............................................... -->
                    <div id="actions-box">
                        <a href="" class="action-slider"></a>
                        <div id="actions-box-slider">
                            <asp:LinkButton ID="MarkAllInactive" CssClass="action-edit" runat="server" OnCommand="markAllInactive_Click">Направи неактивни</asp:LinkButton>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <!-- end actions-box........... -->
                    <div class="clear">
                    </div>
                </div>
                <!--  end content-table-inner ............................................END  -->
            </td>
            <td id="tbl-border-right">
            </td>
        </tr>
        <tr>
            <th class="sized bottomleft">
            </th>
            <td id="tbl-border-bottom">
                &nbsp;
            </td>
            <th class="sized bottomright">
            </th>
        </tr>
    </table>
    <div class="clear">
        &nbsp;</div>
    <!--  end content -->
</asp:Content>
